package org.cms.feature.user.web;

import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.cms.feature.user.entity.SysUser;
import org.cms.feature.user.service.UserService;
import org.cms.util.RUtil;
import org.springframework.web.bind.annotation.*;

@Tag(name = "系统用户")
@RestController
@RequestMapping("/sys_user")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @Operation(summary = "查询用户列表")
    @PostMapping("/findUserList")
    @Parameters(value = {
            @Parameter(name = "no", description = "页数"),
            @Parameter(name = "size", description = "条数")
    })
    public RUtil<PageInfo<SysUser>> findUserList(@RequestParam(defaultValue = "1") int no,
                                                 @RequestParam(defaultValue = "10") int size) {
        return RUtil.success(userService.findUserList(no, size));
    }

}




